def eliminateDuplicates(numbers): 
    result = []  
    for num in numbers:  
        if num not in result:  
            result.append(num)
      
    return result  
# === DO NOT modify the code below ===
def main():
    list1 = [ eval(x) for x in input().split() ]
    list2 = eliminateDuplicates(list1)
    print(" ".join(map(str,list1)))
    print(" ".join(map(str,list2)))
    
if __name__ == "__main__":
    main()
